package chapter04

/**
 * @program lu-scala01
 * @description:
 * @author: zhanglu
 * @create: 2022-04-08 22:45:00
 */
object Lu11_CommonOp {

  def main(args: Array[String]): Unit = {
    val l01 = List(1, 3, 5, 7, 2, 89)
    val s1 = Set(23, 34, 423, 75)

    //获取集合长度
    println(l01.length)
    //获取集合大小
    println(s1.size)
    //循环遍历
    for(e <- l01){
      print(e + " ")
    }
    println()
    s1.foreach(e => print(e + " "))
    println()
    //迭代器
    for(e <- l01.iterator){
      print(e + " ")
    }
    println()
    //生成字符串
    println(l01)
    println(s1)
    println(l01.mkString("-"))
    //是否包含
    println(l01.contains(1))
    println(s1.contains(1))



  }

}
